//
//  HaveTitleExplorationListTableViewCell.m
//  TestApplication
//
//  Created by Hanlingyu on 16/9/1.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "HaveTitleExplorationListTableViewCell.h"
#import "Masonry.h"
#import "ExplorationListJoin.h"
#import "ExplorationListModel.h"
#import "ExplorationListContent.h"

@interface HaveTitleExplorationListTableViewCell ()
@property (nonatomic, strong) UILabel *sectionTitleLabel;

@end

@implementation HaveTitleExplorationListTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _sectionTitleLabel = [[UILabel alloc] init];
        _sectionTitleLabel.backgroundColor = [UIColor colorWithWhite:0.917 alpha:1.000];
        _sectionTitleLabel.font = [UIFont systemFontOfSize:14];
        _sectionTitleLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_sectionTitleLabel];
        
        
    }
    return self;
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    [self.sectionTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).mas_offset(20);
        make.top.mas_equalTo(self.contentView).mas_equalTo(10);
        make.right.mas_equalTo(self.contentView).mas_equalTo(-20);
        make.height.mas_equalTo(20);
    }];

    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(self.sectionTitleLabel.mas_bottom).mas_equalTo(5);
        make.height.mas_equalTo(70);
    }];
    
    
    [self.listContentImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(10);
        make.bottom.mas_equalTo(-10);
        make.width.mas_equalTo(self.listContentImage.mas_height).multipliedBy(1.0f);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10);
        make.left.mas_equalTo(self.listContentImage.mas_right).mas_equalTo(15);
        make.height.mas_equalTo(30);

    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-10);
        make.left.mas_equalTo(self.listContentImage.mas_right).mas_equalTo(15);
        make.right.mas_equalTo(-50);
        make.height.mas_equalTo(20);


    }];
    
    [self.typeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(17);
        make.height.mas_equalTo(15);
        
    }];
    
    
    
    
}

- (void)setListContent:(ExplorationListContent *)listContent {
    [super setListContent:listContent];
    _sectionTitleLabel.text = listContent.title;
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
